package top.jiangqiang.qianyi.business.mapstruct;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import top.jiangqiang.qianyi.business.mapstruct.config.MapperSpringConfig;
import top.jiangqiang.qianyi.common.auth.model.UserDetails;
import top.jiangqiang.qianyi.data.model.entity.AdminUser;
import top.jiangqiang.qianyi.data.model.entity.UserInfo;

@Mapper(config = MapperSpringConfig.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface AdminUserAndUserInfoToAdminUserDetails {
    @Mappings({
            @Mapping(source = "info.id", target = "userId"),
            @Mapping(source = "user.id", target = "authId")
    })
    UserDetails convert(AdminUser user, UserInfo info);
}
